package com.zzx.magic.controller;

import com.zzx.magic.entity.BusinessPlan;
import com.zzx.magic.service.IBusinessPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collections;
import java.util.List;

/**
 * @Author Zhangxx
 * @Date 2024/6/12 14:07
 */
@Api(value = "homepage", description = "首页")
@RestController
@RequestMapping("/homepage")
public class HomePageController {

    @Autowired
    IBusinessPlanService iBusinessPlanService;

    @ApiOperation(value = "新增BP")
    @RequestMapping("/addBp")
    public Integer addBp(BusinessPlan bp) {
        return iBusinessPlanService.addBp(bp);
    }

    @RequestMapping("/updateBp")
    public Integer updateBp(BusinessPlan bp) {
        return iBusinessPlanService.updateBp(bp);
    }

    @RequestMapping("/selectBp")
    public BusinessPlan selectBp(String id) {
        return iBusinessPlanService.selectBp(id);
    }

    @RequestMapping("/deleteBp")
    public Integer deleteBp(String id) {
        return iBusinessPlanService.deleteBp(id);
    }


    //TODO 写成ES查询方式
    @RequestMapping("/queryList")
    public List<BusinessPlan> queryList(String keword, String type) {
       return iBusinessPlanService.queryList(keword, type);
    }

    @RequestMapping("/recommend")
    public List<BusinessPlan> recommend(String type) {
        return iBusinessPlanService.recommend(type);
    }

    @RequestMapping("/tagRecommend")
    public List<BusinessPlan> tagRecommend(String tag) {
        return iBusinessPlanService.tagRecommend(tag);
    }

    @RequestMapping("/tagList")
    public List<String> tagList() {
        return Collections.emptyList();
    }





}